import { Response, ResponseGoods, ResponseIPageGoods } from '@/types/apiType';

import request from '../utils/request';
import { RequestConfig } from '../utils/request/type';

/**
 * @description 商品信息查询
 * @tags 商品接口
 * @summary 商品信息查询
 * @request get:/api/goods/detail
 */
export const apiGoodsDetailByGet = (params: { goodsId: number }, config?: RequestConfig) =>
  request.get<ResponseGoods>(`/api/goods/detail`, params, config).then((res) => res?.result);

/**
 * @description 奖励是否还有库存
 * @tags 商品接口
 * @summary 奖励是否还有库存
 * @request get:/api/goods/hasStock
 */
export const apiGoodsHasStockByGet = (
  params: { activityId: number; goodsId: number },
  config?: RequestConfig
) => request.get<Response>(`/api/goods/hasStock`, params, config).then((res) => res?.result);

/**
 * @description activityId:活动id
 * @tags 商品接口
 * @summary 商品列表
 * @request get:/api/goods/list
 */
export const apiGoodsListByGet = (
  params: { activityId: number; pageNo?: number; pageSize?: number },
  config?: RequestConfig
) => request.get<ResponseIPageGoods>(`/api/goods/list`, params, config).then((res) => res?.result);
